<%@ page language="java" %>

<%@ page import="com.scalar.chiptrack.commons.Constants,
                com.scalar.chiptrack.commons.SessionKeys,
                com.scalar.chiptrack.users.User,
                com.scalar.chiptrack.utils.ConfigManager,
                com.scalar.chiptrack.utils.StringUtils"%>

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>

<chiptrack:checkLogon sourcePage="/financeMenu.do"/>

<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>
<% User user1 = (User)session.getAttribute (SessionKeys.USER_KEY); %>

<html:html locale="true">

<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<style type="text/css">
a { text-decoration : none}
@page {
  size: landscape;
	}
}
</style>

<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type='text/css' rel='stylesheet'>
</HEAD>
<BODY bgColor='#ffffff' leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">

<SCRIPT language="JavaScript">
function sendMail ( customerShipingId, salesOrderId, creditNoteId )
{
    newWindow = window.open ('<%=chipTracContext%>/creditNotesendAckMail.do?action="loadMail' + '&customerShippingId='+customerShipingId +'&salesOrderId='+salesOrderId + '&creditNoteId=' + creditNoteId,'sendMailPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,width=800,height=550,resizable=yes');
    newWindow.focus();
}

</SCRIPT>

<!-- body starts -->

<html:form name="creditNoteForm" type="com.scalar.chiptrack.finance.creditNote.forms.CreditNoteForm" action="/creditNoteAction.do" >
<table border="0" width="100%" align="center">
    <tr>
        <td colspan="4" align="right">
            <table border=0>
                <tr>
                    <td><a href="javascript:window.print();" title='Click here to print the Packing Slip'><img src="<%=chipTracContext%>/jsp/includes/images/printer_icon_small.gif" width='80' height="50" border="0" alt=""></a></td>
                    <td>&nbsp;&nbsp;</td>
                    <td><a href="javascript:sendMail(<bean:write name='creditNoteForm' property='customerId'/>, <bean:write name='creditNoteForm' property='salesOrderId'/>, <bean:write name='creditNoteForm' property='creditNoteId'/>);" title='Click here to send mail'><img src="<%=chipTracContext%>/jsp/includes/images/email1.gif" border="0" alt=""></a></td>
                    <td>&nbsp;&nbsp;</td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
		<td width="20%" align="left">
			<img src="<%=chipTracContext%>/jsp/includes/images/scalar_logo.jpg" height="84" width="200" border=0>
		</td>
        <td width="50%"  align="center" class="NArialL">
			<font class='NArialW'><nested:write property="noteType"/> Note</font><br>
		</td>
        <td width="30%" class="NArialL" align="right" colspan="3">
            <table>
                <tr>
                    <td align="left" class="NArialL">
                        <bean:write name="creditNoteForm" property="clientInfo.clientName" />
                        <bean:write name="creditNoteForm" property="clientAddrWithOutEmailObjFormatted" filter="false"/>
                    </td>
                </tr>
            </table>
        </td>
	</tr>

	<tr><td colspan='5'><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></td></tr>
    <tr>
        <td colspan='5' >
            <table width="90%" align="center" border='0'>
                <tr>
                    <td class="NArialL"><nested:write property="noteType"/> Note #:</td>
                    <td class="bodytext"><nested:write property="creditNoteNumber"/>
                                    <nested:hidden property="creditNoteNumber"/></td>
                    <td>&nbsp;</td>
                    <td class="NArialL">Date Issued:</td>
                    <td class="bodytext"><nested:write property="issueDate"/></td>
                </tr>
                <tr>
                    <td class="NArialL">Customer:</td>
                    <td class="bodytext"><bean:write name="creditNoteForm" property="customerName" /></td>
                    <td>&nbsp;</td>
                    <td class="NArialL">Sales Order No:</td>
                    <td class="bodytext"><bean:write name="creditNoteForm" property="salesOrderNo" /></td>
                </tr>
                <tr>
                    <td class="NArialL">Customer PO No:</td>
                    <td class="bodytext"><bean:write name="creditNoteForm" property="customerPONo" /></td>
                    <td>&nbsp;</td>
                    <td class="NArialL">Sales Rep:</td>
                    <td class="bodytext"><bean:write name="creditNoteForm" property="salesRep" /></td>
                </tr>
                <tr>
                    <td class="NArialL">End Customer:</td>
                    <td class="bodytext"><bean:write name="creditNoteForm" property="endCustomerName" /></td>
                    <td>&nbsp;</td>
                    <td class="NArialL">End User:</td>
                    <td class="bodytext"><bean:write name="creditNoteForm" property="endUserName" /></td>
                </tr>
                <tr>
                    <td class="NArialL"> Pay Terms:</td>
                    <td class="bodytext"><bean:write name="creditNoteForm" property="payTerms" /></td>
                    <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
                    <td class="NArialL">Packing Slip Label:</td>
                    <td class="bodytext"><bean:write name="creditNoteForm" property="packingSlipLabel" /></td>
                </tr>
                <tr>
                    <td class="NArialL" valign="top" >Billing Address:</td>
                    <td class="bodytext"><bean:write name="creditNoteForm" property="billingAddressAsHTML" filter="false"/></td>
                    <td>&nbsp;</td>
                    <td class="NArialL" valign="top">Shipping Address:</td>
                    <td class="bodytext" valign="top"><bean:write name="creditNoteForm" property="shippingAddressAsHTML" filter="false"/></td>
                </tr>
                <tr>
                    <td class="NArialL">Consider Units:</td>
                    <td class="bodytext" valign="top">
                        <nested:equal property="isUnits" value="true">Yes</nested:equal>
                        <nested:notEqual property="isUnits" value="true">No</nested:notEqual>
                    </td>
                </tr>
                <tr>
                    <td class="NArialL">Comments:</td>
                    <td  colspan="5">
                        <nested:write property="comments" />
                    </td>
                </tr>
            </table>
        </td>
    </tr>

    <TR><TD colspan='5'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='10'></TD></TR>
    <tr>
        <td colspan=5>
        <nested:size id="cancelledLineItemsSize" property="cancelledLineItems"/>
        <logic:greaterThan value="0" name="cancelledLineItemsSize">
           <table border="0" width="100%">
               <tr><td colspan=6 class="NArialL">Cancelled LineItems</td></tr>
               <tr>
                    <td width="8%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Line Item #</font></td>
                    <td width="10%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">PO Line Item #</font></td>
                    <td width="10%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF"><bean:message key="label.mfgPartNumber" /></font></td>
                    <td width="10%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF"><bean:message key="label.customerPartNumber"/></font></td>
                    <td width="10%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Description</font></td>
                    <td width="10%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Shipped Qty</font></td>
                    <td width="10%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Ship Date</font></td>
                    <td width="10%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Unit Price</font></td>
                    <td width="10%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Amount</font></td>
                    <td width="10%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Reason</font></td>
                    <td width="10%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Change To Qty</font></td>
                    <td width="10%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Change To Price</font></td>
                    <td width="10%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Change To Amount</font></td>
                </tr>

                <nested:iterate property="cancelledLineItems"  id="lineItem">
                <tr>
                    <td width="8%" bgcolor="#DEE1E2" align=center class="NArialL"> <nested:write property="lineItemNo" /></td>
                    <td width="10%" bgcolor="#DEE1E2" align=center class="NArialL"><nested:write property="poLineItemNo" /></td>
                    <td width="10%" bgcolor="#DEE1E2" align=center class="NArialL"><nested:write property="manufacturingPartNo" /></td>
                    <td width="10%" bgcolor="#DEE1E2" align=center class="NArialL"><nested:write property="customerPartNo" /></td>
                    <td width="10%" bgcolor="#DEE1E2" align=center class="NArialL"><nested:write property="lineItemDescription" /></td>
                    <td width="10%" bgcolor="#DEE1E2" align=center class="NArialL"><nested:write property="shippedQtyAsString" /></td>
                    <td width="10%" bgcolor="#DEE1E2" align=center class="NArialL"><nested:write property="shippedDate" /></td>
                    <td width="10%" bgcolor="#DEE1E2" align=center class="NArialL"><nested:write property="unitPriceAsString" /></td>
                    <td width="10%" bgcolor="#DEE1E2" align=center class="NArialL"><nested:write property="amountAsString" /></td>
                    <td width="10%" bgcolor="#DEE1E2" align=center class="NArialL"><nested:write property="reason" /></td>
                    <td width="10%" bgcolor="#DEE1E2" align=center class="NArialL"><nested:write property="adjustmentQtyAsString" /></td>
                    <td width="10%" bgcolor="#DEE1E2" align=center class="NArialL" nowrap><nested:write property="discountPriceAsString" /></td>
                    <td width="10%" bgcolor="#DEE1E2" align=center class="NArialL" nowrap><nested:write property="discountAmountAsString" /></td>
                </tr>
                </nested:iterate>
            </table>
        </logic:greaterThan>
        </td>
    </tr>
    <TR><TD colspan='5'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='10'></TD></TR>
    <tr>
        <td colspan=5>
        <nested:size id="lineItemsSize" property="lineItems"/>
        <logic:greaterThan value="0" name="lineItemsSize">
           <table border="0" width="100%">
               <tr><td colspan=6 class="NArialL">Current LineItems</td></tr>
               <tr>
                    <td rowspan="2" width="8%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Line Item #</font></td>
                    <td rowspan="2" width="10%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">PO Line Item #</font></td>
                    <td rowspan="2" width="10%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF"><bean:message key="label.mfgPartNumber" /></font></td>
                    <td rowspan="2" width="10%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF"><bean:message key="label.customerPartNumber"/></font></td>
                    <td rowspan="2" width="10%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Description</font></td>
                    <td rowspan="2" width="10%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Shipped Qty</font></td>
                    <td rowspan="2" width="10%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Ship Date</font></td>
                    <td rowspan="2" width="10%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Unit Price</font></td>
                    <td rowspan="2" width="10%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Amount</font></td>
                    <td rowspan="2" width="10%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Reason</font></td>
                    <td rowspan="2" width="10%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Change To Qty</font></td>
                    <td rowspan="2" width="10%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Change To Price</font></td>
                    <td rowspan="2" width="10%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Change To Amount</font></td>
                    <%--<td colspan="4" width="10%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">HOLDS</font></td>--%>
                </tr>
                <tr>
                    <%--<td align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Mktg</font></td>
                    <td align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Fin</font></td>
                    <td align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Ops</font></td>
                    <td align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Sales</font></td>--%>
                </tr>
                <nested:iterate property="lineItems" indexId="idx" id="lineItem">
                <tr>
                    <nested:hidden property="lineItemId"/>
                    <td width="8%" bgcolor="#DEE1E2" align=center class="NArialL"> <nested:write property="lineItemNo" /></td>
                    <td width="10%" bgcolor="#DEE1E2" align=center class="NArialL"><nested:write property="poLineItemNo" /></td>
                    <td width="10%" bgcolor="#DEE1E2" align=center class="NArialL"><nested:write property="manufacturingPartNo" /></td>
                    <td width="10%" bgcolor="#DEE1E2" align=center class="NArialL"><nested:write property="customerPartNo" /></td>
                    <td width="10%" bgcolor="#DEE1E2" align=center class="NArialL"><nested:write property="lineItemDescription" /></td>
                    <td width="10%" bgcolor="#DEE1E2" align=center class="NArialL"><nested:write property="shippedQtyAsString" /></td>
                    <td width="10%" bgcolor="#DEE1E2" align=center class="NArialL"><nested:write property="shippedDate" /></td>
                    <td width="10%" bgcolor="#DEE1E2" align=center class="NArialL"><nested:write property="unitPriceAsString" /></td>
                    <td width="10%" bgcolor="#DEE1E2" align=center class="NArialL"><nested:write property="amountAsString" /></td>
                    <td width="10%" bgcolor="#DEE1E2" align=center class="NArialL"><nested:write property="reason" /></td>
                    <td width="10%" bgcolor="#DEE1E2" align=center class="NArialL" nowrap>
                        <nested:write property="adjustmentQtyAsString" />
                    </td>
                    <td width="10%" bgcolor="#DEE1E2" align=center class="NArialL" nowrap>
                        <nested:write property="discountPriceAsString" />
                    </td>
                    <td width="10%" bgcolor="#DEE1E2" align=center class="NArialL" nowrap>
                        <nested:write property="discountAmountAsString" />
                    </td>
                    <%--<td width="10%" bgcolor="#DEE1E2" align=center class="NArialL">
                        <nested:equal value="0" property="marketingHold">X</nested:equal>
                        <nested:notEqual value="0" property="marketingHold"><nested:write property="marketingHold" /></nested:notEqual>
                    </td>
                    <td width="10%" bgcolor="#DEE1E2" align=center class="NArialL">
                        <nested:equal value="0" property="financeHold">X</nested:equal>
                        <nested:notEqual value="0" property="financeHold"><nested:write property="financeHold" /></nested:notEqual>
                    </td>
                    <td width="10%" bgcolor="#DEE1E2" align=center class="NArialL">
                        <nested:equal value="0" property="operationsHold">X</nested:equal>
                        <nested:notEqual value="0" property="operationsHold"><nested:write property="operationsHold" /></nested:notEqual>
                    </td>
                    <td width="10%" bgcolor="#DEE1E2" align=center class="NArialL">
                        <nested:equal value="0" property="salesHold">X</nested:equal>
                        <nested:notEqual value="0" property="salesHold"><nested:write property="salesHold" /></nested:notEqual>
                    </td>--%>
                </tr>
            </nested:iterate>
                <tr class="NArialL">
                    <td colspan="12" align="right">Total:&nbsp;</td>
                    <td nowrap><nested:write property="totalAdjustmentAmountAsString"/></td>
                </tr>

            </table>
        </logic:greaterThan>
        </td>
    </tr>
    <tr><td><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=5></td></tR>
 <%   if(ConfigManager.getShowTermsLabel())
    {%>
    <TR>
        <TD width='100%' colspan='5' class='NArialRS'><p>SpectraLinears Standard Terms and conditions of Sale are enclosed and are the terms and conditions upon which this Order Acknowledgement is issued.  Unless otherwise stated in a written agreement signed by SpectraLinear. SpectraLinears Standard Terms and Conditions of Sale shall apply to customers purchase order and shall prevail over any conflicting or additional terms in customers purchase order or other documents or forms used by customer, which shall be of no effect. </p></TD>
    </TR>
    <tr><td><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=5></td></tr>
    <% } %>
</table>
<p STYLE="page-break-after: always"></p>
<table width="98%" bordercolor='#000000' border='0' cellspacing='0' cellpadding='0' align="center">
    <TR>
          <TD width='100%' valign='top'><img src='<%=chipTracContext%>/jsp/includes/images/Terms and Condition of Sale.jpg' width='1000'/></TD>
   </TR>
</table>

</html:form>
</body>
</html:html>